www.gusucode.com > 有监督的 CNN 网络完成对MNIST 数字的识别 > 有监督的 CNN 网络完成对MNIST 数字的识别/CNN—卷积神经网络数字识别/back_subsample.m
function out = back_subsample(e, ratio) % back_subsample传播误差通过子样品层 % %语法: % % out = back_subsample(e,ratio) % %描述 %输入: % e -错误的映射 %比例——膨胀率 % %输出: %——传播误差图,大小比例*大小(e) switch ratio case 4 out = 0; for k=1:4 for l=1:4 out(1+(k-1):4:size(e,1)*4,1+(l-1):4:size(e,2)*4) = e; end end % out = out.*0.0625; case 2 out(1:2:size(e,1)*2,1:2:size(e,2)*2)=e; out(1:2:size(e,1)*2,2:2:size(e,2)*2)=e; out(2:2:size(e,1)*2,1:2:size(e,2)*2)=e; out(2:2:size(e,1)*2,2:2:size(e,2)*2)=e; % out=out.*0.25; case 1 out = e; otherwise disp('Unsupported ratio'); end end